package com.vincce.axa.wechat.app.controller;

import com.alibaba.fastjson.JSON;
import com.icbc.eap.ssapi.EapAPI;
import com.icbc.eap.ssapi.impl.BatchObtainTrade;
import com.vincce.axa.wechat.app.core.base.UserSessionHolder;
import com.vincce.axa.wechat.app.service.WxClaimService;
import com.vincce.axa.wechat.core.RedisRunner;
import com.vincce.axa.wechat.core.utils.DBConnection;
import com.vincce.axa.wechat.app.service.CommonService;
import com.vincce.axa.wechat.app.service.PolicyService;
import com.vincce.axa.wechat.core.constant.Constant;
import com.vincce.axa.wechat.core.constant.WechatConstant;
import com.vincce.axa.wechat.core.entity.AxaThistoryRecord;
import com.vincce.axa.wechat.core.utils.CheckUtil;
import com.vincce.axa.wechat.core.utils.ErrorWriterUtil;
import com.vincce.axa.wechat.core.utils.PremCalcUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.ServletContextAware;

import javax.annotation.Resource;
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by lik on 2016/3/8.
 */
@Controller
@RequestMapping("/policy")
public class PolicyWebController implements ServletContextAware {
    Logger logger = LoggerFactory.getLogger(this.getClass());
    @Resource
    private PolicyService policyService;
    @Resource
    CommonService commonService;
    @Resource
    WxClaimService wxClaimService;
    //*Spring这里是通过实现ServletContextAware接口来注入ServletContext对象*/
    private ServletContext servletContext;
    private Connection conn;//用于保存数据库连接对象
    private PreparedStatement ps;//用于执行SQL语句（预处理）
    private ResultSet rs;//用于保存查询的结果集

    private String DATABASE_URL = "";
    private String DATABASE_USRE = "";
    private String DATABASE_PASSWORD = "";

    @Override
    public void setServletContext(ServletContext servletContext) {
        this.servletContext = servletContext;
    }

    /**
     * @param model
     * @param contractNo   保单号
     * @param userId       userID
     * @param mainPlanName 险种名称
     * @return
     */
    @RequestMapping(value = "/policyDown")
    public void policyDown(Model model, String contractNo, String userId, String mainPlanName, String kfwzUserId, HttpServletResponse response) throws Exception {
        logger.info("请求方法 request：/policy/policyDown.htm?POLICY_NO：contractNo={},userId={},kfwzUserId={}", contractNo, userId, kfwzUserId);
        if (CheckUtil.isEmpty(contractNo) || CheckUtil.isEmpty(kfwzUserId)) {
            response.sendError(404, "File not found!");
            return;
        }
        //防止恶意根据保单号查看电子保单
        if (!commonService.checkMyPolicyNo(contractNo, kfwzUserId, "P")) {
            response.sendError(404, "File not found!");
            return;
        }

        //电子保单下载 至服务器
        String busiid = null;
        String printid = null;
        String savePath = "";
        String sql = "select resulturl,xtpfurl,printid from thistory_record where bussno = '" + contractNo + "' and jobcode in ('ePolicy','eGroupPolicy') and status = '1' order by id desc";
        try {
            logger.info("下载保单号前未赋值：该保单号={}：下载成功，busiid={}，printid={}", contractNo, busiid, printid + ".pdf");
            conn = commonService.getConnection(DATABASE_URL, DATABASE_USRE, DATABASE_PASSWORD);
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            while (rs.next()) {
                busiid = rs.getString(2);
                printid = rs.getString(3);
            }
            logger.info("下载保单号前：该保单号={}：下载成功，busiid={}，printid={}", contractNo, busiid, printid + ".pdf");
            String confPath = PolicyController.class.getClassLoader().getResource("/").getPath();
            EapAPI.init(confPath + "eap-ssapi.conf");
            logger.info("该保单号={}：eap-ssapi.conf连接eap服务器成功", contractNo);
            BatchObtainTrade obtainTrade = new BatchObtainTrade();
            obtainTrade.execute(null, busiid, printid + ".pdf", "0");
            if (Constant.USER_SESSION_ENABLE) {
                savePath = "/nas_act_pic/pdfCon/";
            } else {
                savePath = "D:\\123\\";
            }
            File file = new File(savePath);
            if (!file.exists()) {
                file.mkdir();
            }
            obtainTrade.getReturnFolder().saveTo(file);
            logger.info("下载保单号后：该保单号={}：下载成功，busiid={}，printid={}", contractNo, busiid, printid + ".pdf");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            DBConnection.closeResultSet(rs);
            DBConnection.closeStatement(ps);
            DBConnection.closeConnection();
        }
        model.addAttribute("contractNo", contractNo);
        model.addAttribute("appId", WechatConstant.APP_ID);
        model.addAttribute("userId", userId);
        //zs 20171128
        model.addAttribute("mainPlanName", mainPlanName);
        model.addAttribute("pdfName", printid + ".pdf");
        model.addAttribute("rootUrl", Constant.ROOT_URL);
        // this.fileDownload(response, contractNo, "/nas_act_pic/pdfCon/" + printid + ".pdf");
        this.downLoad("/pdfCon/" + printid + ".pdf", response, true, contractNo, userId);
     /*   return "thistoryRecord/policyWeb";*/
    }

    /**
     * 文件下载和直接打开
     *
     * @param path
     * @param response
     * @param isOnLine
     * @throws Exception
     */
    public void downLoad(String path, HttpServletResponse response, boolean isOnLine, String contractNo, String userId) throws Exception {
        //获取网站部署路径(通过ServletContext对象)，用于确定下载文件位置，从而实现下载
        String root = servletContext.getRealPath("/");
        logger.info("servletContext.getRealPath************************" + root);
        File f = new File("/nas_act_pic" + path);
        logger.info("f.getName()**************************************" + f.getName());
        if (!f.exists()) {
            response.sendError(404, "File not found!");
            return;
        }
        BufferedInputStream br = new BufferedInputStream(new FileInputStream(f));
        byte[] buf = new byte[1024];
        int len = 0;
        response.reset(); // 非常重要
        if (isOnLine) { // 在线打开方式/*
           /* URL u = new URL(Constant.ROOT_URL + path);
            logger.info("ContentType:u.openConnection().getContentType()" + u.openConnection().getContentType());*/
            response.setContentType("application/pdf");
            response.setHeader("Content-Disposition", "inline; filename=" + f.getName());
            response.setHeader("Connection", "close");//使用完毕立即断掉 避免使用长链接
            //  response.setCharacterEncoding("UTF-8");
            response.setContentLength(br.available());//显示文件大小
            logger.info("br.available()*****************************" + br.available());
        } else { // 纯下载方式
            response.setContentType("application/x-msdownload");
            // response.setContentType("application/force-download");//应用程序强制下载
            response.setHeader("Content-Disposition", "attachment; filename=" + f.getName());
            response.setCharacterEncoding("UTF-8");
        }
        OutputStream out = response.getOutputStream();
        while ((len = br.read(buf)) > 0)
            out.write(buf, 0, len);
        br.close();
        out.close();
        if (!CheckUtil.isEmpty(contractNo) && !CheckUtil.isEmpty(userId)) {
            try {
                //插入数据
                policyService.insertEPolicyDownload(contractNo, 0, Integer.parseInt(userId));
                //下载成功后调用接口查看接口返回的数据操作返回1，接口调用成功则进行数据库statPolicyDownload进行操作
                Integer returnState = policyService.dowLoadService(Integer.parseInt(userId), contractNo);
                if (returnState == 1) {
                    policyService.updateStatPolicyDownLoad(contractNo);
                }
            } catch (Exception e) {
                logger.info("添加电子保单下载数据报错{}");
            }
        }
    }

    /**
     * @param model
     * @param contractNo 保单号
     * @param userId     userID 废弃
     * @throws Exception
     */
    @RequestMapping(value = "/downLoad")
    public void downLoad(Model model, String contractNo, String userId) throws Exception {
        logger.info("request：/policy/downLoad.htm 请求参数保单号POLICY_NO：{} {}", contractNo, "userId：====" + userId);
        model.addAttribute("state", "false");
        try {
            //插入数据
            policyService.insertEPolicyDownload(contractNo, 0, Integer.parseInt(userId));
            //下载成功后调用接口查看接口返回的数据操作返回1，接口调用成功则进行数据库statPolicyDownload进行操作
            Integer returnState = policyService.dowLoadService(Integer.parseInt(userId), contractNo);
            if (returnState == 1) {
                policyService.updateStatPolicyDownLoad(contractNo);
                model.addAttribute("state", "true");
            }
        } catch (Exception e) {
            logger.info("添加电子保单下载数据报错{}");
        }
    }


    @RequestMapping(value = "/letterDown")
    public String letterDown(Model model, String contractNo, String userId, String mainPlanName) throws SQLException {
        logger.info("请求方法 request：/policy/letterDown.htm请求参数保单号POLICY_NO：{}{}", contractNo + "传过来的userId=" + userId, "mainPlanName==" + mainPlanName);
        String busiid = null;
        String printid = null;
        String docType = null;
        String archiveTime = null;
        String sql = " SELECT TT.BUSINESS_NO,  TT.TEMPLATE_TYPE,  TT.GEN_DATE,  A.PRT_SEQ,  re.xtpfurl  FROM T_I_DOCUMENT A  JOIN (SELECT TO_CHAR(D.GEN_DATE, 'YYYY-MM-DD') GEN_DATE,  D.BUSINESS_TYPE,  E.BUSINESS_NO,  E.NOTICE_TYPE,  E.SEND_FLAG,  E.FILE_URL,  F.TEMPLATE_TYPE,  E.TASK_ID,  D.CFG_NOTICE_TEMPLATE_ID,  C.CFG_NOTICE_TYPE_ID,  MAX(E.I_DOCUMENT_ID) I_DOCUMENT_ID  FROM T_CFG_NOTICE_TYPE  C,  T_I_NOTICE_INFO  D,  T_I_DOCUMENT  E,  T_CFG_NOTICE_TEMPLATE F,  T_CFG_NOTICE_METHOD  H   WHERE D.POLICY_NO = '" + contractNo + "'  AND C.CFG_NOTICE_TYPE_ID = D.CFG_NOTICE_TYPE_ID  AND E.I_DOCUMENT_ID = D.NOTICE_INTERFACE_ID  AND D.CFG_NOTICE_TEMPLATE_ID = F.CFG_NOTICE_TEMPLATE_ID  AND C.CFG_NOTICE_TYPE_ID = H.CFG_NOTICE_TYPE_ID  AND D.SEND_FLAG IN ('1', '2', '3')  AND D.NOTICE_METHOD = '001'  AND H.NOTICE_METHOD = '001'  AND C.RC_STATE = 'E'  AND D.RC_STATE = 'E'  AND E.RC_STATE = 'E'  AND F.RC_STATE = 'E'  AND H.RC_STATE = 'E'  AND E.NOTICE_TYPE IN  ('087', '075', '074', '095', '088', '080', '079', '089',  '090', '091', '078', '084', '085', '066', '081', '093', '21','25')  GROUP BY TO_CHAR(D.GEN_DATE, 'YYYY-MM-DD'),  D.BUSINESS_TYPE,  E.BUSINESS_NO,  E.NOTICE_TYPE,  E.SEND_FLAG,  E.FILE_URL,  F.TEMPLATE_TYPE,  E.TASK_ID,  D.CFG_NOTICE_TEMPLATE_ID,  C.CFG_NOTICE_TYPE_ID) TT ON TT.I_DOCUMENT_ID =   A.I_DOCUMENT_ID    join thistory_record re on A.PRT_SEQ = re.printid  order by TT.GEN_DATE desc ";
        logger.info("执行SQL语句====================" + sql);
        try {
            conn = commonService.getConnection(DATABASE_URL, DATABASE_USRE, DATABASE_PASSWORD);
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            int letterCount = 0;
            logger.info("下载保单号前未赋值：该保单号={}：下载成功，busiid={}，printid=={},docType=={},archiveTime=={}", contractNo, busiid, printid, docType, archiveTime);
            while (rs.next()) {
                if (!model.containsAttribute(rs.getString(2))) {
                    docType = rs.getString(2);
                    archiveTime = rs.getString(3);
                    printid = rs.getString(4);
                    busiid = rs.getString(5);
                    if ("POS_LETTER_035_P".equals(docType) || "POS_LETTER_011_P".equals(docType) || "POS_LETTER_009_P".equals(docType)
                            || "POS_LETTER_010_P".equals(docType) || "POS_LETTER_013_P".equals(docType) || "POS_LETTER_047_P".equals(docType)
                            || "POS_LETTER_014_P".equals(docType) || "POS_LETTER_036_P".equals(docType) || "POS_LETTER_037_P".equals(docType)
                            || "POS_LETTER_038_P".equals(docType) || "POS_LETTER_039_P".equals(docType) || "POS_LETTER_019_P".equals(docType)
                            || "POS_LETTER_020_P".equals(docType) || "POS_ENDORSEMENT".equals(docType) || "CLM_LETTER_007_P".equals(docType)) {
                        letterCount = letterCount + 1;
                    }
                    model.addAttribute(docType, docType);
                    model.addAttribute("b" + docType, busiid);
                    model.addAttribute("p" + docType, printid);
                    model.addAttribute("t" + docType, archiveTime);
                }
            }
            logger.info("下载前已赋值：该保单号={}：下载成功，busiid={}，printid=={},docType=={},archiveTime=={}", contractNo, busiid, printid, docType, archiveTime);
            //以上类型的电子信函数量是否大于0
            if (letterCount > 0) {
                model.addAttribute("flag", "0");
            } else {
                model.addAttribute("flag", "1");
            }
        } catch (Exception e) {
            logger.info("电子保单下载值服务器报错>>>>>>>>>>>>>>>>>{}", ErrorWriterUtil.WriteError(e).toString());
        } finally {
            DBConnection.closeResultSet(rs);
            DBConnection.closeStatement(ps);
            DBConnection.closeConnection();
        }
        model.addAttribute("contractNo", contractNo);
        model.addAttribute("appId", WechatConstant.APP_ID);
        model.addAttribute("userId", userId);
        return "thistoryRecord/policyListcheck";
    }


    /**
     * @param model policyListcheck
     * @throws Exception
     */
    @RequestMapping(value = "/downLoadLetter")
    public String downLoadLetter(Model model, AxaThistoryRecord axaThistoryRecord, HttpServletResponse response) throws Exception {
        logger.info("请求方法 request：/policy/downLoadLetter.htm" + JSON.toJSONString(axaThistoryRecord));
        if ("ser".equals(axaThistoryRecord.getSerDwn())) {
            List<AxaThistoryRecord> axaThistoryRecordList = null;
            if ("POS_ENDORSEMENT".equals(axaThistoryRecord.getDocType())) {
                Calendar ca = Calendar.getInstance();// 得到一个Calendar的实例
                ca.setTime(new java.util.Date()); // 设置时间为当前时间
                ca.add(Calendar.MONTH, -1);// 月份减1
                java.util.Date resultDate = ca.getTime(); // 结果
                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                axaThistoryRecordList = this.getRecordByEndity(axaThistoryRecord, dateFormat.format(resultDate), dateFormat.format(new java.util.Date()));
                //重新查询保全批单默认显示一个月的
            } else {
                axaThistoryRecordList = new ArrayList<AxaThistoryRecord>();
                axaThistoryRecordList.add(axaThistoryRecord);
            }
            model.addAttribute("recordTemp", axaThistoryRecord);
            model.addAttribute("recordList", axaThistoryRecordList);
            return "thistoryRecord/znxIndex";
        }else {
            return "thistoryRecord/pdfShow";
        }
    }

    /**
     * @param model policyListcheck
     * @throws Exception
     */
    @RequestMapping(value = "/downLoadLetterNew")
    public void downLoadLetterNew(Model model, AxaThistoryRecord axaThistoryRecord, HttpServletResponse response) throws Exception {
        logger.info("请求方法 request：/policy/downLoadLetter.htm" + JSON.toJSONString(axaThistoryRecord));
        if ("dwn".equals(axaThistoryRecord.getSerDwn())) {
            //电子保单下载 至服务器
            String savePath = null;
            String confPath = PolicyController.class.getClassLoader().getResource("/").getPath();
            logger.info(confPath);
            EapAPI.init(confPath + "eap-ssapi.conf");
            logger.info("该保单号：eap-ssapi.conf连接eap服务器成功");
            BatchObtainTrade obtainTrade = new BatchObtainTrade();
            obtainTrade.execute(null, axaThistoryRecord.getXtpfUrl(), axaThistoryRecord.getPrintId() + ".pdf", "0");
            if (Constant.USER_SESSION_ENABLE) {
                savePath = "/nas_act_pic/pdfCon/";
                logger.info("存放路劲：" + savePath);
            } else {
                savePath = "D:\\123\\";
            }
            logger.info("savePath：{}", savePath);
            File file = new File(savePath);
            if (!file.exists()) {
                file.mkdir();
            }
            obtainTrade.getReturnFolder().saveTo(file);
            logger.info("电子保单下载值服务器完成>>>>>>>>>>>>>>>>>");
            this.downLoad("/pdfCon/" + axaThistoryRecord.getPrintId() + ".pdf", response, true, "", "");
/*
            model.addAttribute("url", "../../../../pdfCon/" + axaThistoryRecord.getPrintId() + ".pdf");
            return "thistoryRecord/pdfShow";*/
        }
    }

    /**
     * 查询
     *
     * @param model
     * @param axaThistoryRecord
     * @param startDate
     * @param endDate
     * @return
     * @throws IOException
     */
    @RequestMapping(value = "/searchLetter")
    public String findThistoryRecord(Model model, AxaThistoryRecord axaThistoryRecord, String startDate, String endDate) throws IOException {
        List<AxaThistoryRecord> axaThistoryRecordList = this.getRecordByEndity(axaThistoryRecord, startDate, endDate);
        model.addAttribute("recordTemp", axaThistoryRecord);
        model.addAttribute("recordList", axaThistoryRecordList);
        return "thistoryRecord/znxIndex";
    }

    /**
     * 根据时间段，保单号，电子信函类型查询
     *
     * @param axaThistoryRecord
     * @param startDate
     * @param endDate
     * @return
     */
    public List<AxaThistoryRecord> getRecordByEndity(AxaThistoryRecord axaThistoryRecord, String startDate, String endDate) {
        List<AxaThistoryRecord> axaThistoryRecords = new ArrayList<AxaThistoryRecord>();
        try {
            String sql = " SELECT TT.BUSINESS_NO, TT.TEMPLATE_TYPE, TT.GEN_DATE, A.PRT_SEQ, re.xtpfurl, re.resulturl FROM T_I_DOCUMENT A JOIN (SELECT TO_CHAR(D.GEN_DATE, 'YYYY-MM-DD') GEN_DATE, D.BUSINESS_TYPE, E.BUSINESS_NO, E.NOTICE_TYPE, E.SEND_FLAG, E.FILE_URL, F.TEMPLATE_TYPE, E.TASK_ID, D.CFG_NOTICE_TEMPLATE_ID, C.CFG_NOTICE_TYPE_ID, MAX(E.I_DOCUMENT_ID) I_DOCUMENT_ID FROM T_CFG_NOTICE_TYPE C, T_I_NOTICE_INFO D, T_I_DOCUMENT E, T_CFG_NOTICE_TEMPLATE F, T_CFG_NOTICE_METHOD H WHERE D.POLICY_NO = '" + axaThistoryRecord.getBusson() + "' AND F.TEMPLATE_TYPE='" + axaThistoryRecord.getDocType() + "' AND C.CFG_NOTICE_TYPE_ID = D.CFG_NOTICE_TYPE_ID AND E.I_DOCUMENT_ID = D.NOTICE_INTERFACE_ID AND D.CFG_NOTICE_TEMPLATE_ID = F.CFG_NOTICE_TEMPLATE_ID AND C.CFG_NOTICE_TYPE_ID = H.CFG_NOTICE_TYPE_ID AND D.SEND_FLAG IN ('1', '2', '3') AND D.NOTICE_METHOD = '001' AND H.NOTICE_METHOD = '001'  AND D.GEN_DATE >= TO_DATE('" + startDate + "','YYYY-MM-DD') AND D.GEN_DATE <= TO_DATE('" + endDate + "','YYYY-MM-DD') AND C.RC_STATE = 'E' AND D.RC_STATE = 'E' AND E.RC_STATE = 'E' AND F.RC_STATE = 'E' AND H.RC_STATE = 'E' AND E.NOTICE_TYPE IN ('087', '075', '074', '095', '088', '080', '079', '089', '090', '091', '078', '084', '085', '066', '081', '093', '21','25','30') GROUP BY TO_CHAR(D.GEN_DATE, 'YYYY-MM-DD'), D.BUSINESS_TYPE, E.BUSINESS_NO, E.NOTICE_TYPE, E.SEND_FLAG, E.FILE_URL, F.TEMPLATE_TYPE, E.TASK_ID, D.CFG_NOTICE_TEMPLATE_ID, C.CFG_NOTICE_TYPE_ID) TT ON TT.I_DOCUMENT_ID =  A.I_DOCUMENT_ID join thistory_record re on A.PRT_SEQ = re.printid order by TT.GEN_DATE desc";
            logger.info("执行SQL语句====================" + sql);
            conn = commonService.getConnection(DATABASE_URL, DATABASE_USRE, DATABASE_PASSWORD);
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            while (rs.next()) {
                AxaThistoryRecord axaThistoryRecord1 = new AxaThistoryRecord();
                axaThistoryRecord1.setPrintId(rs.getString("PRT_SEQ"));
                axaThistoryRecord1.setXtpfUrl(rs.getString("XTPFURL"));
                axaThistoryRecord1.setArchiveTime(rs.getString("GEN_DATE"));
                axaThistoryRecord1.setDocType(rs.getString("TEMPLATE_TYPE"));
                axaThistoryRecord1.setBusson(axaThistoryRecord.getBusson());
                axaThistoryRecord1.setLetterName(axaThistoryRecord.getLetterName());
                axaThistoryRecords.add(axaThistoryRecord1);
            }
        } catch (Exception e) {
            logger.info("电子保单下载值服务器报错>>>>>>>>>>>>>>>>>{}", ErrorWriterUtil.WriteError(e).toString());
        } finally {
            DBConnection.closeResultSet(rs);
            DBConnection.closeStatement(ps);
            DBConnection.closeConnection();
        }
        return axaThistoryRecords;
    }

    /**
     * @param model      堆栈对象
     * @param contractNo 保单号
     * @param userId     用户id
     * @param printId    打印流水号
     * @author 张顺
     * @time 20171220
     * 理赔通知书查看
     */
    @RequestMapping("/claimLetterDown")
    public String claimLetterDown(Model model, String contractNo, String userId, String printId) throws SQLException {
        logger.info("请求方法 request：/policy/letterDown.htm请求参数保单号POLICY_NO：{}{}{}", contractNo, userId, printId);
        model.addAttribute("appId", WechatConstant.APP_ID);
        List<AxaThistoryRecord> axaThistoryRecordList = null;
        String erroMsg = null;
        try {
            if (!CheckUtil.isEmpty(contractNo) && !CheckUtil.isEmpty(userId) && !CheckUtil.isEmpty(printId)) {
                axaThistoryRecordList = wxClaimService.getPendingTypeCode(new String[]{}, contractNo, printId);
                if (!CheckUtil.isEmpty(axaThistoryRecordList) && axaThistoryRecordList.size() > 0) {
                    model.addAttribute("flag", "0");
                } else {
                    model.addAttribute("flag", "1");
                }

            } else {
                erroMsg = "参数错误，请稍后重试！";
            }
        } catch (Exception e) {
            erroMsg = e.getMessage();
            logger.info("电子保单下载值服务器报错>>>>>>>>>>>>>>>>>{}", ErrorWriterUtil.WriteError(e).toString());
        }

        if (!CheckUtil.isEmpty(erroMsg)) {
            model.addAttribute("Msgs", erroMsg);
            return "Error";
        }
//        model.addAttribute("contractNo", contractNo);
//        model.addAttribute("userId", userId);
        model.addAttribute("recordList", axaThistoryRecordList);
        return "wxclaim/claimZnxIndex";
    }

}
